﻿<common:LayoutAwarePage
    x:Name="pageRoot"
    x:Class="XnReader.WinRT.Forms.OnlineStore"
    DataContext="{Binding DefaultViewModel, RelativeSource={RelativeSource Self}}"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:XnReader.WinRT.Forms"
    xmlns:common="using:XnReader.WinRT.Common"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:Controlx="using:XnReader.WinRT.Controlx" mc:Ignorable="d">

    <Page.Resources>
        <Style x:Key="ButtonStyleNav" TargetType="Button">
            <Setter Property="Background" Value="#FF039C32"/>
            <Setter Property="Foreground" Value="White"/>
            <Setter Property="BorderBrush" Value="#FF039C32"/>
            <Setter Property="BorderThickness" Value="2"/>
            <Setter Property="Padding" Value="0"/>
            <Setter Property="Margin" Value="0"/>
            <Setter Property="HorizontalAlignment" Value="Left"/>
            <Setter Property="VerticalAlignment" Value="Center"/>
            <Setter Property="FontFamily" Value="{StaticResource ContentControlThemeFontFamily}"/>
            <Setter Property="FontWeight" Value="SemiBold"/>
            <Setter Property="FontSize" Value="{StaticResource ControlContentThemeFontSize}"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Button">
                        <Grid>
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="CommonStates">
                                    <VisualState x:Name="Normal"/>
                                    <VisualState x:Name="PointerOver">
                                        <Storyboard>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="Border">
                                                <DiscreteObjectKeyFrame KeyTime="0" Value="Silver"/>
                                            </ObjectAnimationUsingKeyFrames>
                                            <!--<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentPresenter">
                                                <DiscreteObjectKeyFrame KeyTime="0" Value="White"/>
                                            </ObjectAnimationUsingKeyFrames>-->
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="Pressed">
                                        <Storyboard>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="Border">
                                                <DiscreteObjectKeyFrame KeyTime="0" Value="Silver"/>
                                            </ObjectAnimationUsingKeyFrames>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderThickness" Storyboard.TargetName="Border">
                                                <DiscreteObjectKeyFrame KeyTime="0" Value="2"/>
                                            </ObjectAnimationUsingKeyFrames>
                                            <!--<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentPresenter">
                                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ButtonPressedForegroundThemeBrush}"/>
                                            </ObjectAnimationUsingKeyFrames>-->
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="Disabled">
                                        <Storyboard>
                                            <!--<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="Border">
                                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ButtonDisabledBackgroundThemeBrush}"/>
                                            </ObjectAnimationUsingKeyFrames>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="Border">
                                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ButtonDisabledBorderThemeBrush}"/>
                                            </ObjectAnimationUsingKeyFrames>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentPresenter">
                                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ButtonDisabledForegroundThemeBrush}"/>
                                            </ObjectAnimationUsingKeyFrames>-->
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                                <VisualStateGroup x:Name="FocusStates">
                                    <VisualState x:Name="Focused">
                                        <Storyboard>
                                            <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="FocusVisualWhite"/>
                                            <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="FocusVisualBlack"/>
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="Unfocused"/>
                                    <VisualState x:Name="PointerFocused"/>
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                            <Border x:Name="Border" BorderBrush="{TemplateBinding BorderBrush}"  BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Margin="3">
                                <ContentPresenter x:Name="ContentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" ContentTransitions="{TemplateBinding ContentTransitions}" Content="{TemplateBinding Content}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                            </Border>
                            <Rectangle x:Name="FocusVisualWhite" IsHitTestVisible="False" Opacity="0" StrokeDashOffset="1.5" StrokeEndLineCap="Square" Stroke="{StaticResource FocusVisualWhiteStrokeThemeBrush}" StrokeDashArray="1,1"/>
                            <Rectangle x:Name="FocusVisualBlack" IsHitTestVisible="False" Opacity="0" StrokeDashOffset="0.5" StrokeEndLineCap="Square" Stroke="{StaticResource FocusVisualBlackStrokeThemeBrush}" StrokeDashArray="1,1"/>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </Page.Resources>

    <!--
        此网格用作定义以下两行的页的根面板:
        * 第 0 行包含后退按钮和页标题
        * 第 1 行包含页布局的其余部分
    -->
    <Grid Background="#FFE6EBD4" >
        <Grid.RowDefinitions>
            <RowDefinition Height="120"/>
            <RowDefinition Height="30"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <!-- 在大多数视图状态中使用的水平滚动网格-->
      
        <Grid x:Name="gridNav" Grid.Row="2" VerticalAlignment="Top" Margin="140,0,0,0" HorizontalAlignment="Left">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="140"></RowDefinition>
                    <RowDefinition Height="140"></RowDefinition>
                    <RowDefinition Height="140"></RowDefinition>
                    <RowDefinition Height="140"></RowDefinition>
                    <RowDefinition Height="*"></RowDefinition>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="250"></ColumnDefinition>
                    <ColumnDefinition Width="*"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <Button Tag="101" Grid.Row="0" Style="{StaticResource ButtonStyleNav}" Click="ButtonClick">
                    <Grid  Width="250" Height="120" VerticalAlignment="Center">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="90"></RowDefinition>
                            <RowDefinition Height="Auto"></RowDefinition>
                        </Grid.RowDefinitions>
                        <TextBlock Text="❁" Foreground="White" FontSize="68" TextAlignment="Center" ></TextBlock>
                        <TextBlock Grid.Row="1" Text="全本阅读" Foreground="White" FontSize="14" TextAlignment="Left" Padding="10,0,0,0"></TextBlock>
                    </Grid>
                </Button>
                <StackPanel Grid.Row="1" Orientation="Horizontal">
                    <Button Tag="1" Grid.Row="0" Style="{StaticResource ButtonStyleNav}" Click="ButtonClick">
                        <Grid  Width="120" Height="120" VerticalAlignment="Center">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="90"></RowDefinition>
                                <RowDefinition Height="Auto"></RowDefinition>
                            </Grid.RowDefinitions>
                            <TextBlock Text="✡" Foreground="White" FontSize="68" TextAlignment="Center" ></TextBlock>
                            <TextBlock Grid.Row="1" Text="玄幻奇幻" Foreground="White" FontSize="14" TextAlignment="Left" Padding="10,0,0,0"></TextBlock>
                        </Grid>
                    </Button>
                    <Button Tag="2"  Grid.Row="0" Style="{StaticResource ButtonStyleNav}" Click="ButtonClick">
                        <Grid  Width="120" Height="120" VerticalAlignment="Center">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="90"></RowDefinition>
                                <RowDefinition Height="Auto"></RowDefinition>
                            </Grid.RowDefinitions>
                            <TextBlock Text="☯" Foreground="White" FontSize="68" TextAlignment="Center" ></TextBlock>
                            <TextBlock Grid.Row="1" Text="武侠仙侠" Foreground="White" FontSize="14" TextAlignment="Left" Padding="10,0,0,0"></TextBlock>
                        </Grid>
                    </Button>
                </StackPanel>
                <StackPanel Grid.Row="2" Orientation="Horizontal">
                    <Button Tag="5" Grid.Row="0" Style="{StaticResource ButtonStyleNav}" Click="ButtonClick">
                        <Grid  Width="120" Height="120" VerticalAlignment="Center">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="90"></RowDefinition>
                                <RowDefinition Height="Auto"></RowDefinition>
                            </Grid.RowDefinitions>
                            <TextBlock Text="⚽" Foreground="White" FontSize="68" TextAlignment="Center" ></TextBlock>
                            <TextBlock Grid.Row="1" Text="游戏竞技" Foreground="White" FontSize="14" TextAlignment="Left" Padding="10,0,0,0"></TextBlock>
                        </Grid>
                    </Button>
                    <Button Tag="4"  Grid.Row="0" Style="{StaticResource ButtonStyleNav}" Click="ButtonClick">
                        <Grid  Width="120" Height="120" VerticalAlignment="Center">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="90"></RowDefinition>
                                <RowDefinition Height="Auto"></RowDefinition>
                            </Grid.RowDefinitions>
                            <TextBlock Text="☭" Foreground="White" FontSize="68" TextAlignment="Center" ></TextBlock>
                            <TextBlock Grid.Row="1" Text="历史军事" Foreground="White" FontSize="14" TextAlignment="Left" Padding="10,0,0,0"></TextBlock>
                        </Grid>
                    </Button>
                </StackPanel>
                <Button Tag="3"  Grid.Row="3" Style="{StaticResource ButtonStyleNav}" Click="ButtonClick">
                    <Grid  Width="250" Height="120" VerticalAlignment="Center">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="90"></RowDefinition>
                            <RowDefinition Height="Auto"></RowDefinition>
                        </Grid.RowDefinitions>
                        <TextBlock Text="⚭" Foreground="White" FontSize="68" TextAlignment="Center" ></TextBlock>
                        <TextBlock Grid.Row="1" Text="都市言情" Foreground="White" FontSize="14" TextAlignment="Left" Padding="10,0,0,0"></TextBlock>
                    </Grid>
                </Button>
                <Button Tag="6"  Grid.Row="0" Grid.RowSpan="1" Grid.Column="1" Style="{StaticResource ButtonStyleNav}" Click="ButtonClick">
                    <Grid  Width="120" Height="120" VerticalAlignment="Center">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="90"></RowDefinition>
                            <RowDefinition Height="Auto"></RowDefinition>
                        </Grid.RowDefinitions>
                        <TextBlock Text="⚛" Foreground="White" FontSize="68" TextAlignment="Center" ></TextBlock>
                        <TextBlock Grid.Row="1" Text="科幻灵异" Foreground="White" FontSize="14" TextAlignment="Left" Padding="10,0,0,0"></TextBlock>
                    </Grid>
                </Button>
                <Button Tag="7"  Grid.Row="1" Grid.Column="1" Style="{StaticResource ButtonStyleNav}" Click="ButtonClick">
                    <Grid  Width="120" Height="120" VerticalAlignment="Center">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="90"></RowDefinition>
                            <RowDefinition Height="Auto"></RowDefinition>
                        </Grid.RowDefinitions>
                        <TextBlock Text="⚘" Foreground="White" FontSize="68" TextAlignment="Center" ></TextBlock>
                        <TextBlock Grid.Row="1" Text="漫画同人" Foreground="White" FontSize="14" TextAlignment="Left" Padding="10,0,0,0"></TextBlock>
                    </Grid>
                </Button>
                <Button Tag="10001" Grid.Row="2" Grid.Column="1" Style="{StaticResource ButtonStyleNav}" Click="ButtonClick">
                    <Grid  Width="120" Height="120" VerticalAlignment="Center">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="90"></RowDefinition>
                            <RowDefinition Height="Auto"></RowDefinition>
                        </Grid.RowDefinitions>
                        <TextBlock Text="⛋" FontFamily="Segoe UI Symbol" Foreground="White" FontSize="68" TextAlignment="Center" ></TextBlock>
                        <TextBlock Grid.Row="1" Text="最新更新" Foreground="White" FontSize="14" TextAlignment="Left" Padding="10,0,0,0"></TextBlock>
                    </Grid>
                </Button>
                <Button Tag="10002" Grid.Row="3" Grid.Column="1" Style="{StaticResource ButtonStyleNav}" Click="ButtonClick">
                    <Grid  Width="120" Height="120" VerticalAlignment="Center">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="90"></RowDefinition>
                            <RowDefinition Height="Auto"></RowDefinition>
                        </Grid.RowDefinitions>
                        <TextBlock Text="" FontFamily="Segoe UI Symbol" Foreground="White" FontSize="68" TextAlignment="Center" ></TextBlock>
                        <TextBlock Grid.Row="1" Text="搜书" Foreground="White" FontSize="14" TextAlignment="Left" Padding="10,0,0,0"></TextBlock>
                    </Grid>
                </Button>
            </Grid>
         </Grid>

        <!-- 后退按钮和页标题-->
        <Grid Grid.ColumnSpan="2" VerticalAlignment="Center">
            <Border HorizontalAlignment="Left" VerticalAlignment="Center">
                <Image x:Name="imgLogo" Source="../Assets/logo_small.png" Width="250" Height="80" Margin="120,0,0,0"></Image>
            </Border>
            <Border HorizontalAlignment="Right" VerticalAlignment="Center">
                <Controlx:CommandDx x:Name="header"></Controlx:CommandDx>
            </Border>
         </Grid>

        <VisualStateManager.VisualStateGroups>

            <!-- 视觉状态反映应用程序的视图状态-->
            <VisualStateGroup x:Name="ApplicationViewStates">
                <VisualState x:Name="FullScreenLandscape"/>
                <VisualState x:Name="Filled"/>

                <!-- 整页采用较窄的 100 像素页边距约定(纵向)-->
                <VisualState x:Name="FullScreenPortrait">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="backButton" Storyboard.TargetProperty="Style">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PortraitBackButtonStyle}"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="itemGridView" Storyboard.TargetProperty="Padding">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="96,136,86,56"/>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>

                <!--
                    对齐后，后退按钮和标题的样式将有所不同，并且列表表示形式将被
                    所有视图状态中显示的网格所替代
                -->
                <VisualState x:Name="Snapped">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="gridNav" Storyboard.TargetProperty="Margin">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="0"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="header" Storyboard.TargetProperty="Visibility">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
                        </ObjectAnimationUsingKeyFrames>
                        <!--<ObjectAnimationUsingKeyFrames Storyboard.TargetName="backButton" Storyboard.TargetProperty="Style">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SnappedBackButtonStyle}"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="pageTitle" Storyboard.TargetProperty="Style">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SnappedPageHeaderTextStyle}"/>
                        </ObjectAnimationUsingKeyFrames>

                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="itemListView" Storyboard.TargetProperty="Visibility">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="itemGridView" Storyboard.TargetProperty="Visibility">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
                        </ObjectAnimationUsingKeyFrames>-->
                    </Storyboard>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
    </Grid>
</common:LayoutAwarePage>
